var express = require('express');
var router = express.Router();
//引入mysql
var mysql=require('../utils/Home.js')
//引入mysql语句
var sqls=require('../utils/sqlStatements.js');
/* GET home page. */
router.get('/', function(req, res, next) {
  var sql=sqls.navList;
  var arr=[{},{},{}],
  i=0,inde=0;
  mysql.query(sql,function(err,result){
    
    result.map((item,index)=>{
    arr[i]["key"+(++inde)]=Object.values(item)[0];
    arr[i]['path'+(inde)]=Object.values(item)[1]
    if(inde==3){
      inde=0;
      ++i
    }
    
  });
  console.log(arr,9999999999);
 res.json(arr);
  //关闭数据库
  
});
})

module.exports = router;
